<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function Person(name) {
        this.name = name
      }

      Person.prototype.work = function () {
        console.log(this.name + ' 在工作')
      }

      let p1 = new Person('cym')

      // p1.work()

      p1.work = function () {
        console.log('我在看小说')
      }

      p1.work()
    </script>
  </body>
</html>
